/**
 * 初始化场景与相机
 */
export default function mixinSceneCamera(Incident) {
  Incident.prototype.initSceneCamera = function() {
    const { width, height } = this.$gl
    const scene = new THREE.Scene()
    const camera = new THREE.PerspectiveCamera(50, width / height, 1, 3000)

    camera.position.z = 120
    camera.position.y = 2

    camera.target = new THREE.Vector3()
    camera.target.copy(camera.position)

    // window.camera = camera;
    scene.frustumCulled = false
    // 雾化效果
    scene.fog = new THREE.Fog(0x66685D, 100, 400)
    scene.add(camera)

    this.labelScene = new THREE.Scene()
    this.labelScene.fog = scene.fog

    this.scene = scene
    this.camera = camera
    this.cameraVelocity = new THREE.Vector3()

    this.scene.tick = function() {
      for (var i = 0; i<this.children.length; i++) {
        if (this.children[i].tick) {
          this.children[i].tick();
        }
      }
    };
  }
}
